package o2o.dao.TO.sync;

import lombok.Data;
import lombok.experimental.Accessors;
import o2o.dao.PO.order.OrderGoods;
import o2o.dao.PO.order.OrderInfo;
import org.springframework.beans.BeanUtils;

/**
 * @author Jahnke【1029777564@qq.com】
 * @ClassName OrderGoodsTO
 * @Description:
 * @date 2019/8/6 16:19
 * @Version 1.0
 */
@Data
@Accessors(chain = true)
public class OrderGoodsTO {

    private Long id;
    private Long shopId;
    private Long goodsId;
    private String name;
    private String imageUrl;
    private Double price;
    private Double totalCount;
    private Double totalPrice;
    private Double packetPrice;
    private Double totalPacketPrice;
    private Double totalMoney;

    public OrderGoods convertInfo(OrderInfo order) {
        OrderGoods info = new OrderGoods();
        BeanUtils.copyProperties(this, info);
        info.setOrderNo(order.getOrderNo());
        if (this.getShopId() == null || this.getShopId() < 1) {
            info.setShopId(order.getShopId());
        }
        info.setIsZhekou(0);
        return info;
    }
}
